//
//  AppDelegate.m
//  LoveTourism
//
//  Created by qianfeng0 on 16/6/24.
//  Copyright © 2016年 王超. All rights reserved.
//

#import "AppDelegate.h"
#import "FirstOrNO.h"
#import "RootViewController.h"
#import "TabBarVC.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [self initRootVc];
    
    
    
    [self.window makeKeyAndVisible];
    return YES;
}
//初始化根视图控制器
- (void)initRootVc {
    
    //记录用户打开应用的次数
    [FirstOrNO recordUserOpenAppTimes];
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = [UIColor whiteColor];
    
    //如果是第一次打开应用，就来到引导页
    if ([FirstOrNO isFirstOpen]) {
        
        RootViewController * rootView = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
        self.window.rootViewController = rootView;
        
    }else{
        //如果不是第一次打开，就直接进入主页面
        
        UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        TabBarVC * vc = [storyboard instantiateViewControllerWithIdentifier:@"TabBarVC"];
        
        self.window.rootViewController = vc;
    }
}

@end
